import Notify from '@vant/weapp/notify/notify'
function socketTask() {
    wx.connectSocket({
        url: 'ws://localhost:8080/listen_new_notify',
    })
    wx.onSocketOpen(function () {
        console.log('连接成功');
    })
    wx.onSocketMessage((result) => {
        if (result.data) {
            Notify({ type: 'success', message: '您有新的通知o~' })
        }
    })
    wx.onSocketClose(function (res) {
        console.log('WebSocket 已关闭！')
    })
}

export default {
    socketTask
}